using System;
using System.Collections;
using System.Collections.Generic;
using Code.Core.Utility;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;

public class TestExprMapper
{
    // A Test behaves as an ordinary method
    [Test]
    public void TestExprMapperSimplePasses()
    {
        var testA2 = new TestA { Id = 2, Name = "张三2" };
        TestB testB2 = ExprMapper<TestA, TestB>.Map(testA2);//委托不存在时自动生成，存在时调用静态缓存
        Debug.Log($"testB.Id={testB2.Id},testB.Ids={testB2.Ids},testB.Name={testB2.Name}");
        
        TestC testC = ExprMapper<TestA, TestC>.Map(testA2);//委托不存在时自动生成，存在时调用静态缓存
        Debug.Log($"testC.Id={testC.Id},testC.Ids={testC.Ids},testC.Name={testC.Name}");

        TestD testD = ExprMapper<TestA, TestD>.Map(testA2);//委托不存在时自动生成，存在时调用静态缓存
        Debug.Log($"testC.Id={testD.Id},testC.Ids={testD.Ids},testC.Name={testD.Name}");

        TestD testD1 = new TestD() {Id = 3, Name = "张三D"  };
        TestA testA3 = ExprMapper<TestD, TestA>.Map(testD1);//委托不存在时自动生成，存在时调用静态缓存
        Debug.Log($"testC.Id={testA3.Id},testC.Ids={testA3},testC.Name={testA3.Name}");
        
        
    }


    
    internal class TestA
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

    internal class TestB
    {
        public int Id { get; set; }
        public string Ids { get; set; }
        public string Name { get; set; }
    }
    
    internal class TestC
    {
        private int _id;
        private string _ids;
        private string _name;

        public int Id
        {
            get => _id;
            set => _id = value;
        }

        public string Ids
        {
            get => _ids;
            set => _ids = value;
        }

        public string Name
        {
            get => _name;
            set => _name = value;
        }
    }
    
    internal class TestD
    {
        public int Id;
        public string Ids;
        public string Name;
        
    }
    
    
    
}
